<?

JCAT_Package::ImportClass('JCAT_ViewGtk',JCAT::PACKAGE_MVCGTK) ;

class JCATInfoView extends JCAT_ViewGtk implements JCAT_IViewForm
{
	/**
	 * 控件基本信息
	 * 
	 * @access	public
	 * @param	$aParent=null	JCAT_ViewGtk		拥有此视图的对象
	 * @param	$aUI=null		JCAT_UIGtkGlade		模版引擎
	 * @return	array
	 */
	public function JCATInfoView( JCAT_IViewContainer $aParent, JCAT_UIGtkGlade $aUI=null )
	{
		$this->JCAT_ViewGtk('JCATInfoView','JCATInfoView','JCATInfoView',$aParent,$aUI) ;
		
		
		// 创建 并 初始化 UICtrl ---------------------------
		$sUICtrlDir = dirname(__FILE__).'/Instance.UICtrl' ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('ProjectName',$sUICtrlDir),'ProjectName') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('ProjectIntro',$sUICtrlDir),'ProjectIntro') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('VersionPrimary',$sUICtrlDir),'VersionPrimary') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('VersionMinor',$sUICtrlDir),'VersionMinor') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('VersionModify',$sUICtrlDir),'VersionModify') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('ProjectDir',$sUICtrlDir),'ProjectDir') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('JCATEntranceFile',$sUICtrlDir),'JCATEntranceFile') ;
		$this->AddUICtrl(JCAT_Package::ImportInstance('CopyJCAT',$sUICtrlDir),'CopyJCAT') ;
	}
	
	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	void
	 */
	public function GetProjectDir()
	{
		$aProjectDir = $this->GetUICtrl('ProjectDir') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aProjectDir,'JCAT_IUIGtkCtrl') ;
		
		return $aProjectDir->GetExchangeData() ;		
	}
	
	/**
	 * 浏览项目主目录
	 * 
	 * @access	public
	 * @return	void
	 */
	public function OnBrowseMainDir()
	{
		JCAT_Package::ImportClass('JCAT_GtkFSDialog',JCAT::PACKAGE_MVCGTK) ;
		$sPath = JCAT_GtkFSDialog::Choose(
			Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER
		) ;
		
		// 用户放弃
		if( $sPath===null )
		{
			return ;
		}
		
		JCAT_ASSERT::ASSERT_DIR($sPath) ;
		$sPath = JCAT_Global::TidyPath($sPath) ;
		
		// 在视图上显示
		$aUICtrl = $this->GetUICtrl('ProjectDir') ;
		$wndProjectDir = $aUICtrl->GetMainWidget() ;
		JCAT_ASSERT::ASSERT_INSTANCE($wndProjectDir,'GtkEntry') ;
		
		$wndProjectDir->set_text($sPath) ;
	}


}

JCAT_Package::ImportInterface('JCAT_IViewForm',JCAT::PACKAGE_MVC) ;

?>